<?php

use yii\db\Migration;

class m171011_090540_alter_table_user_add_col extends Migration
{
    public function safeUp()
    {
        $sql = <<<EOF
        ALTER TABLE `ehr`.`user` 
        ADD COLUMN `avatar` VARCHAR(255) NULL COMMENT '头像' AFTER `updated_at`,
        ADD COLUMN `fullname` VARCHAR(255) NULL COMMENT '全名' AFTER `avatar`,
        ADD COLUMN `position` VARCHAR(255) NULL COMMENT '职位' AFTER `fullname`;
EOF;
        $this->execute($sql);
    }

    public function safeDown()
    {
        echo "m171011_090540_alter_table_user_add_col cannot be reverted.\n";

        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m171011_090540_alter_table_user_add_col cannot be reverted.\n";

        return false;
    }
    */
}
